from django.db import models


class Claim(models.Model):
    user_id = models.ForeignKey('accounts_sys.User', on_delete=models.CASCADE)
    scholar_id = models.CharField(max_length=15)
    claim_time = models.DateTimeField(auto_now_add=True)
    introduction = models.TextField(null=True)
    material_path = models.CharField(max_length=127, null=True)
    status = models.CharField(max_length=15, default="pending")  # pending, approved, rejected

    def parse_dict(self):
        return {
            "user_id": self.user_id,
            "scholar_id": self.scholar_id,
            "claim_time": self.claim_time,
            "introduction": self.introduction,
            "material_path": self.material_path,
            "status": self.status
        }
